from django.urls import path
from .views import (index, activities, active_detail, join_activity, add_review, create_activity,
                    like_review, reply_review, browsing_history, delete_browsing_history,
                    add_browsing_history, social, create_discussion, add_discussion_comment,
                    like_discussion, favorite_discussion, share_discussion, delete_discussion,
                    discussion_detail, get_activity_reviews, delete_review, check_activity_status,
                    get_activity_time_status, add_discussion_detail_comment,
                    delete_discussion_detail_comment, like_discussion_detail_comment,
                    send_message, get_messages, get_message_stats)  # 添加导入

urlpatterns = [
    path('index/', index, name='index'),
    path('active/', activities, name='active'),
    path('active_detail/<int:activity_id>/', active_detail, name='active_detail'),

    # 添加报名路由
    path('active_detail/<int:activity_id>/join/', join_activity, name='join_activity'),
    path('join_activity/<int:activity_id>/', join_activity, name='join_activity'),

    path('active_detail/<int:activity_id>/review/', add_review, name='add_review'),
    path('create_activity/', create_activity, name='create_activity'),

    # 活动状态相关API
    path('api/activity/<int:activity_id>/status/', check_activity_status, name='check_activity_status'),
    path('api/activity/<int:activity_id>/time_status/', get_activity_time_status,
         name='get_activity_time_status'),

    # 评论点赞
    path('review/<int:review_id>/like/', like_review, name='like_review'),

    # 回复评论
    path('review/<int:review_id>/reply/', reply_review, name='reply_review'),
    # 删除评论
    path('review/<int:review_id>/delete/', delete_review, name='delete_review'),
    path('active_detail/<int:activity_id>/review/', add_review, name='add_review'),

    # 浏览历史
    path('history/', browsing_history, name='browsing_history'),
    path('delete_browsing_history/', delete_browsing_history, name='delete_all_browsing_history'),
    path('delete_browsing_history/<int:history_id>/', delete_browsing_history, name='delete_single_browsing_history'),
    path('api/add_browsing_history/<int:activity_id>/', add_browsing_history, name='add_browsing_history'),

    # 社区
    path('social/', social, name='social'),
    path('social/discussion/create/', create_discussion, name='create_discussion'),
    path('social/discussion/<int:discussion_id>/comment/', add_discussion_comment, name='add_discussion_comment'),
    path('social/discussion/<int:discussion_id>/like/', like_discussion, name='like_discussion'),
    path('social/discussion/<int:discussion_id>/favorite/', favorite_discussion, name='favorite_discussion'),
    path('social/discussion/<int:discussion_id>/share/', share_discussion, name='share_discussion'),
    path('social/discussion/<int:discussion_id>/delete/', delete_discussion, name='delete_discussion'),
    path('social/discussion/<int:discussion_id>/', discussion_detail, name='discussion_detail'),

    # 社区讨论评论相关路由
    path('social/discussion/<int:discussion_id>/comment/', add_discussion_detail_comment, name='add_discussion_comment'),
    path('social/comment/<int:comment_id>/like/', like_discussion_detail_comment, name='like_discussion_comment'),
    path('social/discussion/<int:discussion_id>/delete_comment/', delete_discussion_detail_comment, name='delete_discussion_comment'),

    # 私信功能路由 - 新增
    path('send_message/', send_message, name='send_message'),
    path('get_messages/', get_messages, name='get_messages'),
    path('get_message_stats/', get_message_stats, name='get_message_stats'),
]